import smtplib
from email.mime.text import MIMEText
from Qshop.settings import SENDER,PASSWORD

def sendMessagae(recver,content,subject="Q商城"):
    sender = SENDER
    password = PASSWORD

    message = MIMEText(content,"plain","utf-8")
    #内容
    #内容类型 plain 文本
    #内容编码
    message["To"] = recver
    message["From"] = sender
    message["Subject"] = subject

    smtp = smtplib.SMTP_SSL("smtp.163.com",994) #登陆163邮件服务器
    smtp.login(user = sender,password = password) #登陆自己的账号

    smtp.sendmail(sender,[recver],message.as_string())
    #发送人
    #收件人（列表）
    #内容
    smtp.close()

if __name__ == '__main__':
    sendMessagae("3392279511@qq.com","快下课了，咳咳咳。")